home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TPBIND.ARJ / LDB2.PAS < prev    next >
Pascal/Delphi Source File  |  1991-05-22  |  1KB  |  54 lines

  1.  
  2.     program ldb2;
  3.         uses bind;
  4.  
  5.         type strPtr = ^string;
  6.  
  7.  
  8.         const
  9.             s1 : string = 'Now is the time';
  10.                 s2 : string = 'for all programmers';
  11.                 s3 : string = 'to stop reinventing';
  12.                 s4 : string = 'the linked list';
  13.                 s5 : string = 'and container classes.';
  14.  
  15.  
  16.         function strcmp(D1, D2 : pointer) : integer; far;
  17.         begin
  18.             if (strPtr(D1)^ < strPtr(D2)^) then
  19.                     strcmp := -1
  20.                 else if (strPtr(D1)^ > strPtr(D2)^) then
  21.                     strcmp := 1
  22.                 else
  23.                     strcmp := 0
  24.         end;
  25.  
  26.  
  27.         var B : Binder;
  28.             i : word;
  29.  
  30.     begin
  31.         B.Init;
  32.                 B.setDelta(1);
  33.                 B.setLimit(3);
  34.                 B.setMaxNodes(3);
  35.  
  36.         B.push(@s1);
  37.         B.insq(@s2);
  38.         B.atIns(B.getNodes,@s3);
  39.         B.insq(@s4);
  40.                 B.insq(@s5);
  41.  
  42.         while (B.next) do
  43.             writeln(strPtr(B.current)^);
  44.  
  45.                 B.setComparE(strcmp);
  46.                 if (B.findFirst(@s3) <> BNOTFOUND) then
  47.             writeln(strPtr(B.current)^);
  48.  
  49.                 B.Done;
  50.  
  51.                 readln
  52.  
  53.         end.
  54.